package tests;

import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;

public class EditPage extends Utils {
    public static String url = "http://127.0.0.1:9091/blog_edit.html";
    public EditPage() {
        super(url);
    }

    public void EditSuc() throws InterruptedException {

        String blogTitle = "我的selenium测试";
        driver.findElement(By.cssSelector("#title")).sendKeys(blogTitle);
        driver.findElement(By.cssSelector("#submit")).click();

        //检测是否是成功发布：对比一下列表页第一个博客的标题是否一致就行了
        Thread.sleep(3000);
        String title = driver.findElement(By.cssSelector("body > div.container > div.right > div:nth-child(1) > div.title")).getText();
        assert title.equals(blogTitle);

       driver.quit();
    }
}
